Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

連想配列の追加(再) #738

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

FineArchs
Copy link
Member

手違いにより #693 が閉じられてしまったので再作成します。

概要

let sampledic = dic {
  [1]: null
  ['hoge']: 'fuga'
  [[1, 2, 4]]: [4, 5, 6]
  [Core:add]: @(){ print(1) }
}

let key = [1, 2, 4]
<: sampledic[key] // [4, 5, 6]

名前空間記法との兼ね合いから、キーは全て[ ]で囲うようになっています。
キーの等価性はdeep-equalになっています(関数のみ参照比較)。

実装

トライ木の構造を採用しています。
その都合上、キーを直列化する仕組みを導入しています。

Why

#225

備考

  • 循環参照対策はまだしていません
  • 同時書き込み対策はまだしていません
  • console.jsが書き換わっているのはついでです。変数が保持されるようになっています
  • 別PRで組み込みプロパティの追加もしたいです

@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 59.45946% with 120 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/interpreter/serial-expression.ts 41.91% 79 Missing ⚠️
src/interpreter/util.ts 36.00% 16 Missing ⚠️
src/interpreter/index.ts 53.84% 12 Missing ⚠️
src/interpreter/dic.ts 86.66% 6 Missing ⚠️
src/interpreter/value.ts 72.72% 3 Missing ⚠️
src/parser/syntaxes/expressions.ts 95.45% 2 Missing ⚠️
src/utils/mustbenever.ts 33.33% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
src/node.ts 71.42% <100.00%> (-26.95%) ⬇️
src/parser/plugins/validate-keyword.ts 88.33% <ø> (-0.29%) ⬇️
src/parser/scanner.ts 94.41% <100.00%> (+5.64%) ⬆️
src/parser/token.ts 100.00% <100.00%> (ø)
src/utils/random/genrng.ts 52.27% <100.00%> (+0.18%) ⬆️
src/parser/syntaxes/expressions.ts 91.92% <95.45%> (+2.73%) ⬆️
src/utils/mustbenever.ts 33.33% <33.33%> (ø)
src/interpreter/value.ts 95.71% <72.72%> (-4.29%) ⬇️
src/interpreter/dic.ts 86.66% <86.66%> (ø)
src/interpreter/index.ts 92.48% <53.84%> (+6.68%) ⬆️
... and 2 more

... and 21 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants